import { FileChunk } from "./files"

onmessage = async (e) => {
    const proms = []
    const { files, CHUNK_SIZE, startIndex, endIndex } = e.data
    for(let i = startIndex; i < endIndex; i++) {
        proms.push(FileChunk(files, i, CHUNK_SIZE))
    }
    const chunks = await Promise.all(proms);
    postMessage(chunks)
}